package com.douya.pangu.application.sys.controller;

import com.douya.common.pojo.vo.CommonResponseVO;
import com.douya.pangu.core.api.sys.fegin.CoreUserFeign;
import com.douya.pangu.core.api.sys.pojo.vo.CoreUserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 说明：用户接口
 *
 * @Author hcy
 * @Date 2022/11/10
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/web/sys/user")
public class UserController {

    @Resource
    CoreUserFeign coreUserFeign;


    /**
     * 说明：登录
     *
     * @return 登录用户信息
     */
    @GetMapping("/findByUser")
    public  CommonResponseVO<CoreUserVO>  findByUser(
            @NotNull(message = "ID不能为空") @RequestParam("id") Long id
    ) {
        return coreUserFeign.findById(id);
    }

    @GetMapping("/findAllUser")
    public  CommonResponseVO<List<CoreUserVO>>  findAllUser(
    ) {
        return CommonResponseVO.success(coreUserFeign.findAllUser());
    }

}
